home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / vlapak1.zip / TEXTBALL.ZIP / TEXTBALL.TXT < prev    next >
Text File  |  1993-06-13  |  2KB  |  55 lines

  1.  
  2.       Welcome to yet another free chunk o' code brought to you by VLA...
  3.  
  4.  
  5.     This is just a small routine that plots a text ball at a specific (x,y)
  6. position.  Nothing more.  It's going to be used in a PONG type game that
  7. our dear friend Desolation is going to be working on in C... (All to improve 
  8. those skills of his...)  Anyways, if and when he gets it completed, the
  9. code to that will be released...  Happy happy joy joy!
  10.                                             ■ Draeden /VLA
  11.  
  12.  
  13.                            kInDa TecHnikaL PaRt
  14.                            ────────────────────
  15.  
  16.  
  17. AKA:    Oh, wow!  How'd you do that? (in plain English...)
  18.  
  19.  
  20.     In short, I used 4 characters to put the ball on the screen.  I rewrite
  21. those 4 characters every time I move the ball.  The ball has 8 positions
  22. in both the verticle direction and the horizontal direction...
  23. The character cell (x,y) position is found by taking the Xpos and Ypos
  24. and dividing both by 8 (8x8 character set) and then figuring the offset like:
  25.  
  26. Offset = ((Ypos/8)*80 + Xpos/8) * 2
  27.  
  28.     The 80 is because of the screen width, the *2 is because every other
  29. byte (the odd ones) is an attribute byte.
  30.  
  31.     So I take that offset and place 4 characters there like this:
  32.  
  33.     12  
  34.     34
  35.  
  36.     Then I write new characters to the VGA card, rotating the Xpos and 
  37. adding to the source offset for the Ypos- only using the lowest 3 bits.
  38.  
  39.     When I go to write a new ball, I erase the old one.  Pretty simple, eh?
  40. I'd explain more, but I think you'd be better off taking a look at the code.
  41. Anyways...  May not be too useful, but it's kinda cute. =)
  42.  
  43. Until next time...
  44.  
  45.     ■ Draeden
  46.  
  47. ───
  48.  
  49. Famous Quotes:
  50. ─────────────
  51.               Do you want to change your name to Homer Junior?
  52.                        The kids can call you HoJu.
  53.                                
  54.                             ■ Homer Simpson ■
  55.